home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
modeler
/
logotron.lwm
< prev
next >
Wrap
Text File
|
1993-12-13
|
3KB
|
153 lines
/* CMD: Logotron
*
* Generate nice beveled text.
*/
call addlib "rexxsupport.library", 0, -30, 0
call addlib "rexxmathlib.library", 0, -30, 0
call addlib "LWModelerARexx.port", 0
sysnam = 'Logotron'
filnam = 'T:textile.state'
version = 'Textile v1.01'
styles = 'Flat Block Chisel Round'
corners = 'B B S S'
/* Setup state. Read stored one, if any.
*/
font = 0
str = "Logo"
typ = 1
deep = 0.1
wide = 0.02
if (exists(filnam)) then do
if (~open(state, filnam, 'R')) then break
if (readln(state) = version) then do
parse value readln(state) with font typ deep wide .
str = readln(state)
end
call close state
if (font > fontcount()) then font = 0
end
/* Post values for inspection and update.
*/
call req_begin sysnam
id_font = req_addcontrol("Font", 'f')
id_str = req_addcontrol("Text", 's', 30)
id_typ = req_addcontrol("Style", 'c', styles)
id_deep = req_addcontrol("Depth", 'n', 1)
id_wide = req_addcontrol("Edge Width", 'n', 1)
call req_setval id_font, font
call req_setval id_str, str
call req_setval id_typ, typ
call req_setval id_deep, deep, 0.1
call req_setval id_wide, wide, 0.02
if (~req_post()) then do
call req_end
exit
end
font = req_getval(id_font)
str = req_getval(id_str)
typ = req_getval(id_typ)
deep = req_getval(id_deep)
wide = req_getval(id_wide)
call req_end
/* Save state now, in case something fails.
*/
if (open(state, filnam, 'W')) then do
call writeln state, version
call writeln state, font typ deep wide
call writeln state, str
call close state
end
/* Get some scratch layers.
*/
origl = curlayer()
empty = emptylayers()
if (words(empty) < 2) then do
call notify 1,syscode,"!Need at least two empty layers","!for this operation."
exit
end
sl1 = word(empty, 1)
sl2 = word(empty, 2)
/* Compute a good base name for surfaces.
*/
sbase = ''
do i=1 to words(str)
sbase = sbase || word(str, i)
if length(sbase) >= 5 then leave
end
if length(sbase) > 15 then sbase = left(sbase, 15)
/* Create flat character polygons in sl1 and sl2.
*/
call setlayer sl1
call maketext(str, font, word(corners, typ), wide * 2)
call copy
call setlayer sl2
call paste
/* Sweep out sides from copy in sl2 and remove faces.
*/
call sel_mode('user')
call sel_polygon('set')
interpret 'call Bevel_' || word(styles, typ)
call cut
call changesurface(sbase || "_Side")
/* Get the correct faces from sl1.
*/
call setlayer sl1
call changesurface(sbase || "_Face")
call flip
call cut
call setlayer sl2
call paste
/* Symmeterize and clean up new object.
*/
call mirror(Z, -deep/2)
call mergepoints
call cut
call setlayer origl
call paste
exit
Bevel_Block:
call bevel(0, deep / 2)
return
Bevel_Chisel:
call shapebevel(-wide wide (-wide) deep/2)
return
Bevel_Round:
n = 5
pat = ''
do i=1 to n
a = 3.14159/2 * i / n
pat = pat (-sin(a)*wide) (1-cos(a))*wide
end i
call shapebevel(pat (-wide) deep/2)
return